﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiVertexData : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiVertexData(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiVertexData obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiVertexData()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiVertexData(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGiVertexData() : this(GlobalsPINVOKE.new_OdGiVertexData(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setNormals(OdGeVector3d normals)
		{
			GlobalsPINVOKE.OdGiVertexData_setNormals(this.swigCPtr, OdGeVector3d.getCPtr(normals));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setOrientationFlag(OdGiOrientationType orientationType)
		{
			GlobalsPINVOKE.OdGiVertexData_setOrientationFlag(this.swigCPtr, (int)orientationType);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setTrueColors(OdCmEntityColor colors)
		{
			GlobalsPINVOKE.OdGiVertexData_setTrueColors(this.swigCPtr, OdCmEntityColor.getCPtr(colors));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setMappingCoords(OdGiVertexData.MapChannel channel, OdGePoint3d coords)
		{
			GlobalsPINVOKE.OdGiVertexData_setMappingCoords(this.swigCPtr, (int)channel, OdGePoint3d.getCPtr(coords));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeVector3d normals()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiVertexData_normals(this.swigCPtr);
			OdGeVector3d result = (intPtr == IntPtr.Zero) ? null : new OdGeVector3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiOrientationType orientationFlag()
		{
			OdGiOrientationType result = (OdGiOrientationType)GlobalsPINVOKE.OdGiVertexData_orientationFlag(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdCmEntityColor trueColors()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiVertexData_trueColors(this.swigCPtr);
			OdCmEntityColor result = (intPtr == IntPtr.Zero) ? null : new OdCmEntityColor(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d mappingCoords(OdGiVertexData.MapChannel channel)
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiVertexData_mappingCoords(this.swigCPtr, (int)channel);
			OdGePoint3d result = (intPtr == IntPtr.Zero) ? null : new OdGePoint3d(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public enum MapChannel
		{
			kAllChannels
		}
	}
}
